package com.codefish.codefishseckill.validator.annotation;

import com.codefish.codefishseckill.validator.IsMobileValidator;
import com.codefish.codefishseckill.validator.ValidatorMessage;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * 校验手机号的注解
 *
 * @author codefish
 * @version 1.0
 * @date 2022/07/05 下午 04:33
 */
@Documented
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(
        validatedBy = {IsMobileValidator.class}
)
public @interface IsMobile {
    String message() default ValidatorMessage.IS_MOBIE_MESSAGE;

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    boolean required() default true;
}
